﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NMoq.Core
{
    public class IdentifierFactory
    {
        private static readonly MethodCallIdentifier MethodCallIdentifier = new MethodCallIdentifier();
        private static readonly MethodInfoIdentifier MethodInfoIdentifier = new MethodInfoIdentifier();

        public static IIdentifier CreateIdentifier<TAction>() 
            where TAction : IAction
        {
            
            if (typeof(TAction) == typeof(IVerifier))
                return MethodInfoIdentifier;

            if (typeof(TAction) == typeof(IDataProvider))
                return MethodCallIdentifier ;

            if (typeof(TAction) == typeof ( IInterceptor))
                return MethodCallIdentifier;

            return  MethodCallIdentifier;
        }

        public static int GetIndentifier<TAction>(MethodMessageInfo methodMessageInfo)
            where TAction : IAction
        {
            return CreateIdentifier<TAction>().GetIdentifier(methodMessageInfo);
        }
    }
}
